package threads;

import java.awt.EventQueue;
import java.util.List;

import main.Interface;

public class FileRefresher extends Thread {

	private final Interface context;
	private final List<String> games;

	public FileRefresher(Interface context, List<String> games){
		this.context = context;
		this.games = games;
	}
	
	@Override
	public void run() {
		if(games!=null&&games.size()>0){
			EventQueue.invokeLater(new Runnable(){
				@Override
				public void run() {
					for(int i=0; i<games.size(); i++){
						context.updateFileList(games.get(i));
					}
				}
			});
		}
		EventQueue.invokeLater(new Runnable(){
			@Override
			public void run() {
				context.enableBar();
			}
		});
		
	}
}
